<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function isLeapYear(year) {
            return year % 4 ==0 && year % 100 != 0;
        }
        function dayOfYear(year,month,day){
            if(month == 1){
                return day
            }
            let monthArr = [31,28,31,30,31,30,31,31,30,30,31]
            for(let i=0;i<month-1;i++){
                day+=monthArr[i]
            }
            if(isLeapYear(year) && month>2){
                day++
            }
            return day
        }
        let dataInfo = {
            year:2016,
            month:3,
            day:1
        }
        console.log(dayOfYear(dataInfo.year,dataInfo.month,dataInfo.day))
    </script>
</body>
</html>